perm filename SMAC.SAI[X,ALS] blob sn#805252 filedate 1985-09-26 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00010 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	programs using this file:
C00003 00003	requires, characters, and simple cliches
C00004 00004	ifc debug thenc
C00006 00005	! i/o macros
C00008 00006	! display macros
C00010 00007	! misc
C00011 00008	! ugetf
C00012 00009	! exit
C00013 00010	! reload -- to reload the input buffer the right way
C00014 ENDMK
C⊗;
comment programs using this file:
FM.SAI[X,ALS]
programs using the original SAIMAC.SAI[CSP,SYS]:
PULL.SAI[X,REF]
FOLMRG.SAI[MRG,REF]
HASH.SAI[MRG,REF]
MAPHAS.SAI[MRG,REF]
FMUNGE.SAI[FNT,REF]
OLDFM.SAI[FNT,REF]
PREPRO.SAI[CRO,REF]
STATE.SAI[SHO,REF]
XGPEDIT.SAI[SHO,REF]
RENAME.SAI[SHO,REF]
XS.SAI[FAI,REF]
wild[sho,ref]
fontca.sai[fnt,ref]
;
Comment requires, characters, and simple cliches;
	require "⊂⊃<>" delimiters;

	define crlf = ⊂('15&'12)⊃;

	define nul = ⊂('00&null)⊃;
	define tab = ⊂('11&null)⊃;
	define lf = ⊂('12&null)⊃;
	define vt = ⊂('13&null)⊃;
	define ff = ⊂('14&null)⊃;
	define cr = ⊂('15&null)⊃;
        define space = ⊂" "⊃;
	define altmode = ⊂('175&null)⊃;
	define alt = ⊂('175&null)⊃;
	define BS = ⊂('177&null)⊃;
	define til =⊂ step 1 until ⊃;
	define TRUE = 1;
	define FALSE= 0;
	define ! = ⊂ COMMENT ⊃;

	let proc = procedure;
	let rem = mod;
ifc debug thenc
	external procedure bail;
	integer bail1x,bail2x,bail3x,bail4x;
	define bail1 = ⊂ if ¬bail1x then bail else bail1x ← bail1x - 1 ⊃;
	define bail2 = ⊂ if ¬bail2x then bail else bail2x ← bail2x - 1 ⊃;
	define bail3 = ⊂ if ¬bail3x then bail else bail3x ← bail3x - 1 ⊃;
	define bail4 = ⊂ if ¬bail4x then bail else bail4x ← bail4x - 1 ⊃;
	define simp = ⊂ ⊃;
elsec
	define bail1 = ⊂ ⊃;
	define bail2 = ⊂ ⊃;
	define bail3 = ⊂ ⊃;
	define bail4 = ⊂ ⊃;
	let simp = simple;
endc

ifc debug thenc
procedure pa(integer array foo;integer !from,!to,octal);
begin
integer ii,jj;
for ii ← !from til !to do 
if octal=1 then outstr(cvos(foo[ii])&" ")
else if octal=2 then outstr(cvstr(foo[ii]))
else if octal=6 then outstr(cvxstr(foo[ii]))
else outstr(cvs(foo[ii])&" ");
outstr(crlf);
end;
elsec
endc
! i/o macros;

	define tpri (s) = ⊂ PRINT (s,crlf) ⊃ ;

	define msg (s) = ⊂ OUTSTR("s"&'15&'12) ⊃;

	define pval (s) = ⊂ print("/ s /",s) ⊃ ;

	define pvalx (s) = ⊂ print("/ s /",s,crlf) ⊃ ;


	define writeon(chan,filly) = ⊂
	    begin "righton"
		integer qwerty;
		qwerty ← 0;
		open(chan,"DSK",0,0,1,qwerty,qwerty,qwerty);
		do begin "entme"
		    enter(chan,filly,qwerty);
		    if qwerty then 
			begin "entererror"
			outstr("Enter error on "&filly& "File? ");
			filly ← inchwl;
			end "entererror";
		end "entme" until ¬qwerty;
	    end "righton"
	    ⊃;

define skipform(channel) = ⊂ 
	begin
	string stemp;
	stemp ← null;
	while stemp[∞ for 1]≠ff do stemp ← input(channel,skiptoform) ;
	end ⊃;

string procedure _in_ (integer chan,table);
	return(input(chan,table));
! display macros;
! Permits filling a datadisc piece of paper and displaying it.
  One displays the string s, at the top of the page, clearing, with
  the DISPLAY macro.

  The procedure ESCAPE permits the invoation of various TTYSET commands,
imitating some of the esc/brk commands of the keyboard.  The first argument
is the letter to be esc broken, the second, the repeat arg, and the
third is 1 if the command is to be a break command
;

	define needdisplay = ⊂
require "outdd.rel[x,als]" load_module;
external procedure outdd(string s; INTEGER SPOS(2), PPOS(-1));
procedure escape(integer lett,numb(0),break(0));
begin "esc"
	own integer escapetable;
	escapetable←('4000 lsh 18) lor (numb lsh 9) lor 
		(break lsh 8) lor lett;
	call('777777000000 lor location(escapetable),"TTYSET");
end "esc";
	define display(s) = ⊂ begin if DATADISC then outdd(s,-2,-1) 
					else outstr(s); end ⊃; 
	define cleardisplay = ⊂ begin if DATADISC then
		begin escape("P",0,1);escape("N") end ; end ⊃;
	boolean procedure datadisc;
	begin
	    integer stuff,i;
	    stuff ← -1;
	    i← code(('051 lsh 27) lor (6 lsh 23) , stuff);
	    return (stuff land  (2  lsh 30));
	end;
	⊃;

! old cleardisplay:	define cleardisplay = ⊂outdd(crlf,-2,-1)⊃;
! misc;


define digit(s) = ⊂ ( s≤"9" ∧ s≥"0" ) ⊃;
define letter(s) = ⊂ ( ((s land '137)≤ "Z")∧((s land '137)≥"A")) ⊃;


define incr(var)= ⊂ var ← var + 1 ⊃ ;
define decr(var)= ⊂ var ← var - 1 ⊃ ;

! ugetf
temporary gets chan, value it gets;
define ugetf (val,chan,add) = ⊂val ← code ('073000000000+'40000000*chan,add) ⊃;
! exit;

define xit = ⊂ call(1,"exit") ⊃;
! reload -- to reload the input buffer the right way;
proc reload (string inputsentence);
begin "reload"
    integer ttychar1,ttychar2,ttychar3;
    ttychar2 ← (003 lsh 27) lor location(ttychar3);
    ttychar1 ← call((-1 lsh 18) lor location(ttychar2),"TTYSET");
    if ttychar3 land '460000000000 then ! III, DM or DD;
	loded (  inputsentence & crlf)
    else ptostr(0,inputsentence) ;
end "reload";